//业务
//依赖模块 headerConfigModule/illustrateModule
var detailsApp = angular.module('reportDetailsApp', ['utilsModule', 'reportDetailModule']);

detailsApp.controller('subNavCtrl', function($scope, utilsService) {
    if (utilsService.GetRequestParams()) {
        $scope.reportYear = utilsService.GetRequestParams().date.substring(0, 4);
    } else {
        $scope.reportYear = new Date().getFullYear();
    }

});

//控制 Header部分数据显示
detailsApp.controller('headerCtrl', function($scope, utilsService) {
    if (utilsService.GetRequestParams()) {
        $scope.reportMonth = utilsService.GetRequestParams().date.substring(5, 7);
    } else {
        $scope.reportMonth = new Date().getMonth() + 1;
    }
});

// 富文本展示
detailsApp.controller('mainCtrl', function($scope, $sce, utilsService) {

    //$scope.richContentsVisible = false;

    var temp_CircleCompareAnalysis = '<div class="container-fluid jdb-scale-tempArea"><div class="row"><h3>2.2支付侧环比上线分析</h3><p class="indent"style="text-indent:1em;">Todo:从目前趋势图可以看出因上线后出现Bug导致二次上线呈上升趋势,@支付同学关注.</p><div class="row temp-img"><img src="./assets/images/jdb-zhifuhuanbifenxi.png"style="margin-left:40px;width:820px;height:400px;"></div></div><div class="row temp-talbe"><h3>2.3历史事故环比趋势分析</h3><table class="table table-bordered table-hover temp-table"style="margin-left:20px;table-layout:fixed;width:55%;"><thead><tr><th>月份</th><th>数量</th></tr></thead><tbody><tr><td>2017年3月</td><td>17</td></tr><tr><td>2017年4月</td><td>23</td></tr><tr><td>2017年5月</td><td>8</td></tr><tr><td>2017年6月</td><td>23</td></tr></tbody></table></div></div>';
    if (utilsService.getDefaultRequestData().indexOf("2017-06") !== -1) {
        $scope.tempCircleCompareAnalysis = $sce.trustAsHtml(temp_CircleCompareAnalysis);
    } else {
        console.info(utilsService.getDefaultRequestData());
    }

    var promise = utilsService.httpRequest("../../api/processQualityReport/reportDetail.php?" + utilsService.getDefaultRequestData(), "GET", "");
    promise.then(function successFn(res) {
        //todo

        //console.log(res.data.data.sysIntroduces.richTextDataList[0].sysIntroduction[0].richText);
        //console.log(res.data.data.sysIntroduces.queryDate);
        if (res.data.error.returnCode == "0") {

            $scope.richContentsVisible = true;
            ////介绍
            if (res.data.data.sysIntroduces.richTextDataList[0].sysIntroduction.length !== 0) {
                $scope.introductionHTML = $sce.trustAsHtml(res.data.data.sysIntroduces.richTextDataList[0].sysIntroduction[0].richText);
            } else {
                $scope.introductionHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=introduction"> 点此去补充</a></div><br>');
            }

            //console.log("systemBugDesc:" + res.data.data.rich_Table_Process.richTextDataList.length); //6
            //console.log("systemBugDesc:" + res.data.data.rich_Table_Process.richTextDataList[0].systemBugDesc.length); //数组里的第一个对象 数组systemBugDesc 的长度， 无数据则为0
            //console.log("systemBugDesc:" + res.data.data.rich_Table_Process.richTextDataList[5].riskListTable.length); //第6个对象 数组 的长度， 有数据则为1

            ////1.1.1各系统Bug数据
            if (res.data.data.rich_Table_Process.richTextDataList[0].systemBugDesc.length !== 0) {
                $scope.processSystemDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Process.richTextDataList[0].systemBugDesc[0].richText);
            } else {
                $scope.processSystemDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=process_sysBugDesc"> 点此去补充</a></div><br>');
            }


            //1.1.3Bug引入原因类型统计
            if (res.data.data.rich_Table_Process.richTextDataList[1].issueAnalysisDesc.length !== 0) {
                $scope.processBugReasonDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Process.richTextDataList[1].issueAnalysisDesc[0].richText);
            } else {
                $scope.processBugReasonDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=process_bugReasonDesc"> 点此去补充</a></div><br>');
            }

            //1.1.4业务线RD每日Bug达标率
            if (res.data.data.rich_Table_Process.richTextDataList[2].bugRateTable.length !== 0) {
                $scope.processBugRateTableHTML = $sce.trustAsHtml(res.data.data.rich_Table_Process.richTextDataList[2].bugRateTable[0].richText);
            } else {
                $scope.processBugRateTableHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=process_bugRateTable"> 点此去补充</a></div><br>');
            }

            //1.2.1本月开发功能点
            if (res.data.data.rich_Table_Process.richTextDataList[3].scaleOnlineDesc.length !== 0) {
                $scope.processScaleOnlineDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Process.richTextDataList[3].scaleOnlineDesc[0].richText);
            } else {
                $scope.processScaleOnlineDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=process_scaleOnlineDesc"> 点此去补充</a></div><br>');
            }

            //1.3过程中风险-概述
            if (res.data.data.rich_Table_Process.richTextDataList[4].processRiskDesc.length !== 0) {
                $scope.processRiskDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Process.richTextDataList[4].processRiskDesc[0].richText);
            } else {
                $scope.processRiskDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=process_riskDesc"> 点此去补充</a></div><br>');
            }

            //1.3 详细风险列表后的TODO
            if (res.data.data.rich_Table_Process.richTextDataList[5].riskListTable.length !== 0) {
                $scope.processRiskListTableHTML = $sce.trustAsHtml(res.data.data.rich_Table_Process.richTextDataList[5].riskListTable[0].richText);
            } else {
                $scope.processRiskListTableHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=process_riskListTable"> 点此去补充</a></div><br>');
            }


            ////2.1.1业务方向发布统计+todo
            if (res.data.data.rich_Table_Measure.richTextDataList[0].storyDirectionDesc.length !== 0) {
                $scope.storyDirectionDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Measure.richTextDataList[0].storyDirectionDesc[0].richText);
            } else {
                $scope.storyDirectionDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=scale_storyDirectionDesc"> 点此去补充</a></div><br>');
            }

            //2.2.1异常上线总览/分析
            if (res.data.data.rich_Table_Measure.richTextDataList[1].storyAbnormalOnlineDesc.length !== 0) {
                $scope.storyAbnormalOnlineDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Measure.richTextDataList[1].storyAbnormalOnlineDesc[0].richText);
            } else {
                $scope.storyAbnormalOnlineDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=scale_storyAbnormalOnlineDesc"> 点此去补充</a></div><br>');
            }

            //2.2.2详细事故分析/列表
            if (res.data.data.rich_Table_Measure.richTextDataList[2].storyAbnormalDetailTable.length !== 0) {
                $scope.storyAbnormalDetailTableHTML = $sce.trustAsHtml(res.data.data.rich_Table_Measure.richTextDataList[2].storyAbnormalDetailTable[0].richText);
            } else {
                $scope.storyAbnormalDetailTableHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=scale_storyAbnormalDetailTable"> 点此去补充</a></div><br>');
            }

            //2.2.3上线回滚次数
            if (res.data.data.rich_Table_Measure.richTextDataList[3].storyOnlineRollbackDesc.length !== 0) {
                $scope.storyOnlineRollbackDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Measure.richTextDataList[3].storyOnlineRollbackDesc[0].richText);
            } else {
                $scope.storyOnlineRollbackDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=scale_storyOnlineRollbackDesc"> 点此去补充</a></div><br>');
            }

            //2.2.4上线时间超过24点次数
            if (res.data.data.rich_Table_Measure.richTextDataList[4].storyOverdueDesc.length !== 0) {
                $scope.storyOverdueDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Measure.richTextDataList[4].storyOverdueDesc[0].richText);
            } else {
                $scope.storyOverdueDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=scale_storyOverdueDesc"> 点此去补充</a></div><br>');
            }

            //2.2.5紧急上线+todo
            if (res.data.data.rich_Table_Measure.richTextDataList[5].storyUrgentOnline.length !== 0) {
                $scope.storyUrgentOnlineDescHTML = $sce.trustAsHtml(res.data.data.rich_Table_Measure.richTextDataList[5].storyUrgentOnline[0].richText);
            } else {
                $scope.storyUrgentOnlineDescHTML = $sce.trustAsHtml('<br><div class="container"><span class="text-warning"> 暂无数据! </span><a href="editor.html?part=scale_storyUrgentOnline"> 点此去补充</a></div><br>');
            }
        } else {
            layer.open({
                title: 'Error',
                icon: 5,
                content: res.data.error.returnMessage
            });
        }

    }, function failFn(res) {
        layer.msg(res.data.error.returnMessage, {
            icon: 5,
            time: 2000
        });
    });

});

detailsApp.controller('richContentCtrl', function($scope, $sce, utilsService, reportDetailService) {
    var queryPromise = utilsService.httpRequest("../../api/processQualityReport/reportDataDetail.php?" + utilsService.getDefaultRequestData(), "get", "");
    var circleQueryPromise = utilsService.httpRequest("../../api/processQualityReport/getCircleReportDataDetail.php?t=" + utilsService.getCurrentTimestamp(), "get", "");

    queryPromise.then(function successFn(res) {

        if (res.data.error.returnCode == "0") {
            //获取1.1.1 各系统bug统计柱状图数据
            var processMonthBugCount = JSON.parse(res.data.data.process_data.process_MonthBugCount[0].jsonString);

            //Todo
            //1.1.3 Bug引入问题原因类型统计分析
            var processBugTypeCount = JSON.parse(res.data.data.process_data.process_BugTypeCount[0].jsonString);
            // var processBugTypeCount_server = JSON.parse(res.data.data.process_data.process_BugTypeCount[0].jsonString.serverList);
            //console.log(processBugTypeCount.clientList);
            //1.2.1 各业务消化需求统计
            var processBusinessDemandCount = JSON.parse(res.data.data.process_data.process_BusinessDemandCount[0].jsonString);

            //1.3 研发过程中风险统计
            var processRiskCount = JSON.parse(res.data.data.process_data.process_RiskCount[0].jsonString);
            //console.log(JSON.stringify(processRiskCount.list));
            // 1.3 详细风险列表 TODO
            var processRiskDetailList = JSON.parse(res.data.data.process_data.process_RiskDetailList[0].jsonString);
            //console.info("风险列表：\n" + JSON.stringify(processRiskDetailList.RiskDetailList));


            //2.1.1 各业务发布统计图
            var storyBusinessOnlineCount = JSON.parse(res.data.data.scale_data.story_BusinessOnlineCount[0].jsonString);

            //2.2. 本月线上事故分布统计
            var storyAccidentOnlineCount = JSON.parse(res.data.data.scale_data.story_AccidentOnlineCount[0].jsonString);
            // 2.2.2 线上事故列表
            var storyAccidentOnlineDetailList = JSON.parse(res.data.data.scale_data.story_AccidentOnlineDetailList[0].jsonString);

            //开始绘图了，🙄
            //1.1.1 各系统bug统计柱状图
            reportDetailService.createColumnCharts("本月各业务线Bug数据情况", "#process_MonthBugCount", processMonthBugCount, "bug");
            //1.1.3 Bug引入问题原因类型统计分析
            reportDetailService._createColumnCharts("前端方向bug引入原因分析", "#process_BugTypeCount_client", processBugTypeCount, "bug", "client");
            reportDetailService.IllustratePie(processBugTypeCount, "title", "#process_BugTypeCount_client_pie", "client");
            reportDetailService._createColumnCharts("server方向bug引入原因分析", "#process_BugTypeCount_server", processBugTypeCount, "bug");
            reportDetailService.IllustratePie(processBugTypeCount, "title", "#process_BugTypeCount_server_pie", "server");

            //1.2.1 各业务消化需求统计柱状图
            reportDetailService.createColumnCharts("各业务方向本月消化需求量", "#process_BusinessDemandCount", processBusinessDemandCount, "需求数量");

            //1.3 研发过程中风险统计 饼图 + 表格
            // 创建表格 jdb-process-risk riskcounts type-table
            $scope.processRiskCountTable = $sce.trustAsHtml(reportDetailService.createTable("风险来源统计", ['风险来源', '数量'], processRiskCount, ""));
            reportDetailService.IllustratePie(processRiskCount, "风险来源统计", "#process_RiskCount_pie", "");
            // 详细风险明细列表 -- 表格
            $scope.process_RiskDetailListTable = $sce.trustAsHtml(reportDetailService._createRiskDetailListTable("风险详细列表", ['暴露时间', '各业务方向', '项目', '风险描述', '解决方案'], processRiskDetailList));

            //2.1.1 各业务发布统计柱状图
            reportDetailService.createColumnCharts("本月上线次数分布", "#story_BusinessOnlineCount", storyBusinessOnlineCount, "上线数");

            //  2.2. 本月线上事故分布统计  事故涉及业务方和事故问题归类 饼图 + 表格
            // 创建表格 jdb-scale-storyAbnormalOnline bussiness-direction type-table
            $scope.story_AccidentOnlineCount_directionTable = $sce.trustAsHtml(reportDetailService.createTable("事故涉及业务方向", ['业务方向', '数量'], storyAccidentOnlineCount, "businessDirectionList"));
            reportDetailService._IllustratePie(storyAccidentOnlineCount, "事故涉及业务方向", "#story_AccidentOnlineCount_direction_pie", "businessDirectionList");
            // 创建表格 jdb-scale-storyAbnormalOnline bussiness-type type-table
            $scope.story_AccidentOnlineCount_typelistTable = $sce.trustAsHtml(reportDetailService.createTable("事故涉及问题归类", ['问题类型', '数量'], storyAccidentOnlineCount, "ProblemTypeList"));
            reportDetailService._IllustratePie(storyAccidentOnlineCount, "事故涉及问题归类", "#story_AccidentOnlineCount_typelist_pie", "ProblemTypeList");
            //// 2.2.2 线上事故列表  此处有Bug Todo
            //$scope.story_AccidentOnlineDetailList = $sce.trustAsHtml(reportDetailService._createAccidentOnlineDetailTable("线上事故明细列表", ['事故编号', '事故主题', '优先级', '发现时间', '涉及方向', '问题原因'], storyAccidentOnlineDetailList));
            $scope.story_AccidentOnlineDetailList = $sce.trustAsHtml(reportDetailService._createAccidentOnlineDetailTable("线上事故明细列表", ['事故编号', '事故主题', '优先级', '发现时间', '涉及方向', '问题原因'], storyAccidentOnlineDetailList));


        } else {
            layer.open({
                title: 'Error',
                icon: 5,
                content: res.data.error.returnMessage
            });
        }


    }, function failFn(res) {
        layer.msg(res.data.error.returnMessage, {
            icon: 5,
            time: 2000
        });

    });

    //环比数据分析
    circleQueryPromise.then(function successFn(res) {
        if (res.data.error.returnCode === "0") {
            layer.msg("lomoL!");
            console.info(res.data.data);
        } else {
            layer.open({
                title: 'Error',
                icon: 5,
                content: res.data.error.returnMessage
            });
        }

    }, function failFn(res) {
        layer.msg(res.data.error.returnMessage, {
            icon: 5,
            time: 2000
        });
    });


});

detailsApp.controller('reportDetailsCtrl', function($scope, $sce, utilsService, reportDetailService) {
    //查询时间段内的数据图表
    $scope.getPeriodQuery = function() {
        var beginDate = document.querySelector("input[name='beginDate']").value;
        var endDate = document.querySelector("input[name='endDate']").value;
        if (!reportDetailService.checkDataFormat(beginDate) || !reportDetailService.checkDataFormat(endDate)) {
            layer.msg("您输入的起止日期不合法！<br>正确格式为: yyyy-mm-dd. 请重新输入 O(∩_∩)O", {
                time: 3000
            });
            return;
        }

        if (beginDate !== "" && endDate !== "") {

            //默认展示整月文案，当选择时间段触发后，只显示相关图标数据，富文本部分隐藏
            //var periodQuery_rickTextPromise = utilsService.httpRequest("../../api/processQualityReport/reportDetail.php?" + "beginDate=" + beginDate + "&endDate=" + endDate, "get", "");

            var elementList = ["introductionHTML", "processSystemDescHTML", "processBugReasonDescHTML", "processBugRateTableHTML", "processScaleOnlineDescHTML", "processRiskDescHTML", "processRiskListTableHTML", "storyDirectionDescHTML", "storyAbnormalOnlineDescHTML", "storyAbnormalDetailTableHTML", "storyOnlineRollbackDescHTML", "storyOverdueDescHTML", "storyUrgentOnlineDescHTML"];

            var periodQuery_chartsDatePromise = utilsService.httpRequest("../../api/processQualityReport/reportDataDetail.php?" + "beginDate=" + beginDate + "&endDate=" + endDate, "get", "");
            periodQuery_chartsDatePromise.then(function successFn(res) {
                if (res.data.error.returnCode == "0") {
                    //First, 将富文本隐藏
                    reportDetailService.hideElements(elementList);

                    //刷新图表
                    //获取1.1.1 各系统bug统计柱状图数据
                    var processMonthBugCount = JSON.parse(res.data.data.process_data.process_MonthBugCount[0].jsonString);

                    //Todo
                    //1.1.3 Bug引入问题原因类型统计分析
                    var processBugTypeCount = JSON.parse(res.data.data.process_data.process_BugTypeCount[0].jsonString);
                    // var processBugTypeCount_server = JSON.parse(res.data.data.process_data.process_BugTypeCount[0].jsonString.serverList);
                    //console.log(processBugTypeCount.clientList);
                    //1.2.1 各业务消化需求统计
                    var processBusinessDemandCount = JSON.parse(res.data.data.process_data.process_BusinessDemandCount[0].jsonString);

                    //1.3 研发过程中风险统计
                    var processRiskCount = JSON.parse(res.data.data.process_data.process_RiskCount[0].jsonString);
                    var processRiskDetailList = JSON.parse(res.data.data.process_data.process_RiskDetailList[0].jsonString);

                    //2.1.1 各业务发布统计图
                    var storyBusinessOnlineCount = JSON.parse(res.data.data.scale_data.story_BusinessOnlineCount[0].jsonString);

                    //2.2. 本月线上事故分布统计
                    var storyAccidentOnlineCount = JSON.parse(res.data.data.scale_data.story_AccidentOnlineCount[0].jsonString);
                    // 2.2.2 线上事故列表
                    var storyAccidentOnlineDetailList = JSON.parse(res.data.data.scale_data.story_AccidentOnlineDetailList[0].jsonString);


                    //开始绘图了，🙄
                    //1.1.1 各系统bug统计柱状图
                    reportDetailService.createColumnCharts("本月各业务线Bug数据情况", "#process_MonthBugCount", processMonthBugCount, "bug");
                    //1.1.3 Bug引入问题原因类型统计分析
                    reportDetailService._createColumnCharts("前端方向bug引入原因分析", "#process_BugTypeCount_client", processBugTypeCount, "bug", "client");
                    reportDetailService.IllustratePie(processBugTypeCount, "title", "#process_BugTypeCount_client_pie", "client");
                    reportDetailService._createColumnCharts("server方向bug引入原因分析", "#process_BugTypeCount_server", processBugTypeCount, "bug");
                    reportDetailService.IllustratePie(processBugTypeCount, "title", "#process_BugTypeCount_server_pie", "server");

                    //1.2.1 各业务消化需求统计柱状图
                    reportDetailService.createColumnCharts("各业务方向本月消化需求量", "#process_BusinessDemandCount", processBusinessDemandCount, "需求数量");

                    //1.3 研发过程中风险统计 饼图 + 表格
                    // 创建表格 jdb-process-risk riskcounts type-table
                    //$scope.processRiskCountTable = $sce.trustAsHtml(reportDetailService.createTable("风险来源统计", ['风险来源', '数量'], processRiskCount, ""));
                    document.querySelector("div[ng-bind-html='processRiskCountTable']").innerHTML = reportDetailService.createTable("风险来源统计", ['风险来源', '数量'], processRiskCount, "");
                    reportDetailService.IllustratePie(processRiskCount, "title", "#process_RiskCount_pie", "");
                    //详细的风险列表--
                    document.querySelector("div[ng-bind-html='process_RiskDetailListTable']").innerHTML = reportDetailService._createRiskDetailListTable("风险明细列表", ['暴露时间', '各业务方向', '项目', '风险描述', '解决方案'], processRiskDetailList);

                    //2.1.1 各业务发布统计柱状图
                    reportDetailService.createColumnCharts("本月上线次数分布", "#story_BusinessOnlineCount", storyBusinessOnlineCount, "上线数");

                    //Todo  2.2. 本月线上事故分布统计  事故涉及业务方和事故问题归类 饼图 + 表格
                    //Todo 创建表格 jdb-scale-storyAbnormalOnline bussiness-direction type-table
                    //$scope.story_AccidentOnlineCount_directionTable = $sce.trustAsHtml(reportDetailService.createTable("事故涉及业务方向", ['业务方向', '数量'], storyAccidentOnlineCount, "businessDirectionList"));
                    document.querySelector("div[ng-bind-html='story_AccidentOnlineCount_directionTable']").innerHTML = reportDetailService.createTable("事故涉及业务方向", ['业务方向', '数量'], storyAccidentOnlineCount, "businessDirectionList");
                    reportDetailService._IllustratePie(storyAccidentOnlineCount, "事故涉及业务方向", "#story_AccidentOnlineCount_direction_pie", "businessDirectionList");
                    //Todo 创建表格 jdb-scale-storyAbnormalOnline bussiness-type type-table
                    //$scope.story_AccidentOnlineCount_typelistTable = $sce.trustAsHtml(reportDetailService.createTable("事故涉及问题归类", ['问题类型', '数量'], storyAccidentOnlineCount, "ProblemTypeList"));
                    document.querySelector("div[ng-bind-html='story_AccidentOnlineCount_typelistTable']").innerHTML = reportDetailService.createTable("事故涉及问题归类", ['问题类型', '数量'], storyAccidentOnlineCount, "ProblemTypeList");
                    reportDetailService._IllustratePie(storyAccidentOnlineCount, "事故涉及业务方向", "#story_AccidentOnlineCount_typelist_pie", "ProblemTypeList");

                    //线上事故明细列表
                    //$scope.story_AccidentOnlineDetailList = $sce.trustAsHtml(reportDetailService._createAccidentOnlineDetailTable("线上事故明细列表", ['事故编号', '事故主题', '优先级', '发现时间', '涉及方向', '问题原因'], storyAccidentOnlineDetailList));
                    document.querySelector("div[ng-bind-html='story_AccidentOnlineDetailList']").innerHTML = reportDetailService._createAccidentOnlineDetailTable("线上事故明细列表", ['事故编号', '事故主题', '优先级', '发现时间', '涉及方向', '问题原因'], storyAccidentOnlineDetailList);

                } else {
                    layer.open({
                        title: 'Error',
                        icon: 5,
                        content: res.data.error.returnMessage
                    });
                    //console.log(res.data.error.returnMessage);
                }

            }, function failFn(res) {
                layer.msg(res.data.error.returnMessage, {
                    icon: 5,
                    time: 2000
                });
                //console.log(res.data.error.returnMessage);
            });

        } else {
            layer.msg("请输入开始日期和截止日期 !", {
                icon: 2,
                time: 2000
            });
            return;
        }


    };
});